package com.bytecollege.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bytecollege.model.Cremark;
import com.bytecollege.vo.MyCremarkVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: CremarkMapper
 * @Description:
 * @Author: Sun
 * @Date: 2022/10/18 21:03
 */
@Mapper
public interface CremarkMapper extends BaseMapper<Cremark> {

    @Select("select CreMark_Id, CreMark_Content,Course_Name,u.User_Id,u.User_Name,c.Course_Id,Course_Url,CreMark_Time from cremark left join course c on cremark.Course_Id = c.Course_Id left join user u on cremark.User_Id = u.User_Id where u.User_Id = #{userId}")
    List<MyCremarkVO> cremarkList(Page page,@Param("userId") Integer userId);

    @Select("select count(*) from cremark")
    Integer getCremarkNum();
}